--TEST--
PHP Spec test generated from ./expressions/bitwise_shift_operators/bitwise_shift.php
--FILE--
<?php

/*
   +-------------------------------------------------------------+
   | Copyright (c) 2014 Facebook, Inc. (http://www.facebook.com) |
   +-------------------------------------------------------------+
*/

error_reporting(-1);

$i32 = 1 << 31;	// if this is negative, we have a 32-bit int
$NumBitsPerInt = ($i32 < 0) ? 32 : 64;

// Shift a positive value right and left using both in- and out-of-range counts

$v = 1000;
for ($i = 0; $i <= $NumBitsPerInt + 1; ++$i)
{
	printf("%d(%08X): >> %2d = %08X\t<< %2d = %08X\n", $v, $v, $i, $v >> $i, $i, $v << $i);
}

// Shift a negative value right and left using both in- and out-of-range counts

$v = -1000;
for ($i = 0; $i <= $NumBitsPerInt + 1; ++$i)
{
	printf("%d(%08X): >> %2d = %08X\t<< %2d = %08X\n", $v, $v, $i, $v >> $i, $i, $v << $i);
}

// Shift all kinds of scalar values to see which are ints or can be implicirly converted

$scalarValueList = array(10, -100, 0, 1.234, 0.0, TRUE, FALSE, NULL, "123", 'xx', "");
foreach ($scalarValueList as $v)
{
	printf("%d(%08X): >> %2d = %08X\t<< %2d = %08X\n", $v, $v, 3, $v >> 3, 5, $v << 5);
}
--EXPECTF--
1000(000003E8): >>  0 = 000003E8	<<  0 = 000003E8
1000(000003E8): >>  1 = 000001F4	<<  1 = 000007D0
1000(000003E8): >>  2 = 000000FA	<<  2 = 00000FA0
1000(000003E8): >>  3 = 0000007D	<<  3 = 00001F40
1000(000003E8): >>  4 = 0000003E	<<  4 = 00003E80
1000(000003E8): >>  5 = 0000001F	<<  5 = 00007D00
1000(000003E8): >>  6 = 0000000F	<<  6 = 0000FA00
1000(000003E8): >>  7 = 00000007	<<  7 = 0001F400
1000(000003E8): >>  8 = 00000003	<<  8 = 0003E800
1000(000003E8): >>  9 = 00000001	<<  9 = 0007D000
1000(000003E8): >> 10 = 00000000	<< 10 = 000FA000
1000(000003E8): >> 11 = 00000000	<< 11 = 001F4000
1000(000003E8): >> 12 = 00000000	<< 12 = 003E8000
1000(000003E8): >> 13 = 00000000	<< 13 = 007D0000
1000(000003E8): >> 14 = 00000000	<< 14 = 00FA0000
1000(000003E8): >> 15 = 00000000	<< 15 = 01F40000
1000(000003E8): >> 16 = 00000000	<< 16 = 03E80000
1000(000003E8): >> 17 = 00000000	<< 17 = 07D00000
1000(000003E8): >> 18 = 00000000	<< 18 = 0FA00000
1000(000003E8): >> 19 = 00000000	<< 19 = 1F400000
1000(000003E8): >> 20 = 00000000	<< 20 = 3E800000
1000(000003E8): >> 21 = 00000000	<< 21 = 7D000000
1000(000003E8): >> 22 = 00000000	<< 22 = FA000000
1000(000003E8): >> 23 = 00000000	<< 23 = 1F4000000
1000(000003E8): >> 24 = 00000000	<< 24 = 3E8000000
1000(000003E8): >> 25 = 00000000	<< 25 = 7D0000000
1000(000003E8): >> 26 = 00000000	<< 26 = FA0000000
1000(000003E8): >> 27 = 00000000	<< 27 = 1F40000000
1000(000003E8): >> 28 = 00000000	<< 28 = 3E80000000
1000(000003E8): >> 29 = 00000000	<< 29 = 7D00000000
1000(000003E8): >> 30 = 00000000	<< 30 = FA00000000
1000(000003E8): >> 31 = 00000000	<< 31 = 1F400000000
1000(000003E8): >> 32 = 00000000	<< 32 = 3E800000000
1000(000003E8): >> 33 = 00000000	<< 33 = 7D000000000
1000(000003E8): >> 34 = 00000000	<< 34 = FA000000000
1000(000003E8): >> 35 = 00000000	<< 35 = 1F4000000000
1000(000003E8): >> 36 = 00000000	<< 36 = 3E8000000000
1000(000003E8): >> 37 = 00000000	<< 37 = 7D0000000000
1000(000003E8): >> 38 = 00000000	<< 38 = FA0000000000
1000(000003E8): >> 39 = 00000000	<< 39 = 1F40000000000
1000(000003E8): >> 40 = 00000000	<< 40 = 3E80000000000
1000(000003E8): >> 41 = 00000000	<< 41 = 7D00000000000
1000(000003E8): >> 42 = 00000000	<< 42 = FA00000000000
1000(000003E8): >> 43 = 00000000	<< 43 = 1F400000000000
1000(000003E8): >> 44 = 00000000	<< 44 = 3E800000000000
1000(000003E8): >> 45 = 00000000	<< 45 = 7D000000000000
1000(000003E8): >> 46 = 00000000	<< 46 = FA000000000000
1000(000003E8): >> 47 = 00000000	<< 47 = 1F4000000000000
1000(000003E8): >> 48 = 00000000	<< 48 = 3E8000000000000
1000(000003E8): >> 49 = 00000000	<< 49 = 7D0000000000000
1000(000003E8): >> 50 = 00000000	<< 50 = FA0000000000000
1000(000003E8): >> 51 = 00000000	<< 51 = 1F40000000000000
1000(000003E8): >> 52 = 00000000	<< 52 = 3E80000000000000
1000(000003E8): >> 53 = 00000000	<< 53 = 7D00000000000000
1000(000003E8): >> 54 = 00000000	<< 54 = FA00000000000000
1000(000003E8): >> 55 = 00000000	<< 55 = F400000000000000
1000(000003E8): >> 56 = 00000000	<< 56 = E800000000000000
1000(000003E8): >> 57 = 00000000	<< 57 = D000000000000000
1000(000003E8): >> 58 = 00000000	<< 58 = A000000000000000
1000(000003E8): >> 59 = 00000000	<< 59 = 4000000000000000
1000(000003E8): >> 60 = 00000000	<< 60 = 8000000000000000
1000(000003E8): >> 61 = 00000000	<< 61 = 00000000
1000(000003E8): >> 62 = 00000000	<< 62 = 00000000
1000(000003E8): >> 63 = 00000000	<< 63 = 00000000
1000(000003E8): >> 64 = 00000000	<< 64 = 00000000
1000(000003E8): >> 65 = 00000000	<< 65 = 00000000
-1000(FFFFFFFFFFFFFC18): >>  0 = FFFFFFFFFFFFFC18	<<  0 = FFFFFFFFFFFFFC18
-1000(FFFFFFFFFFFFFC18): >>  1 = FFFFFFFFFFFFFE0C	<<  1 = FFFFFFFFFFFFF830
-1000(FFFFFFFFFFFFFC18): >>  2 = FFFFFFFFFFFFFF06	<<  2 = FFFFFFFFFFFFF060
-1000(FFFFFFFFFFFFFC18): >>  3 = FFFFFFFFFFFFFF83	<<  3 = FFFFFFFFFFFFE0C0
-1000(FFFFFFFFFFFFFC18): >>  4 = FFFFFFFFFFFFFFC1	<<  4 = FFFFFFFFFFFFC180
-1000(FFFFFFFFFFFFFC18): >>  5 = FFFFFFFFFFFFFFE0	<<  5 = FFFFFFFFFFFF8300
-1000(FFFFFFFFFFFFFC18): >>  6 = FFFFFFFFFFFFFFF0	<<  6 = FFFFFFFFFFFF0600
-1000(FFFFFFFFFFFFFC18): >>  7 = FFFFFFFFFFFFFFF8	<<  7 = FFFFFFFFFFFE0C00
-1000(FFFFFFFFFFFFFC18): >>  8 = FFFFFFFFFFFFFFFC	<<  8 = FFFFFFFFFFFC1800
-1000(FFFFFFFFFFFFFC18): >>  9 = FFFFFFFFFFFFFFFE	<<  9 = FFFFFFFFFFF83000
-1000(FFFFFFFFFFFFFC18): >> 10 = FFFFFFFFFFFFFFFF	<< 10 = FFFFFFFFFFF06000
-1000(FFFFFFFFFFFFFC18): >> 11 = FFFFFFFFFFFFFFFF	<< 11 = FFFFFFFFFFE0C000
-1000(FFFFFFFFFFFFFC18): >> 12 = FFFFFFFFFFFFFFFF	<< 12 = FFFFFFFFFFC18000
-1000(FFFFFFFFFFFFFC18): >> 13 = FFFFFFFFFFFFFFFF	<< 13 = FFFFFFFFFF830000
-1000(FFFFFFFFFFFFFC18): >> 14 = FFFFFFFFFFFFFFFF	<< 14 = FFFFFFFFFF060000
-1000(FFFFFFFFFFFFFC18): >> 15 = FFFFFFFFFFFFFFFF	<< 15 = FFFFFFFFFE0C0000
-1000(FFFFFFFFFFFFFC18): >> 16 = FFFFFFFFFFFFFFFF	<< 16 = FFFFFFFFFC180000
-1000(FFFFFFFFFFFFFC18): >> 17 = FFFFFFFFFFFFFFFF	<< 17 = FFFFFFFFF8300000
-1000(FFFFFFFFFFFFFC18): >> 18 = FFFFFFFFFFFFFFFF	<< 18 = FFFFFFFFF0600000
-1000(FFFFFFFFFFFFFC18): >> 19 = FFFFFFFFFFFFFFFF	<< 19 = FFFFFFFFE0C00000
-1000(FFFFFFFFFFFFFC18): >> 20 = FFFFFFFFFFFFFFFF	<< 20 = FFFFFFFFC1800000
-1000(FFFFFFFFFFFFFC18): >> 21 = FFFFFFFFFFFFFFFF	<< 21 = FFFFFFFF83000000
-1000(FFFFFFFFFFFFFC18): >> 22 = FFFFFFFFFFFFFFFF	<< 22 = FFFFFFFF06000000
-1000(FFFFFFFFFFFFFC18): >> 23 = FFFFFFFFFFFFFFFF	<< 23 = FFFFFFFE0C000000
-1000(FFFFFFFFFFFFFC18): >> 24 = FFFFFFFFFFFFFFFF	<< 24 = FFFFFFFC18000000
-1000(FFFFFFFFFFFFFC18): >> 25 = FFFFFFFFFFFFFFFF	<< 25 = FFFFFFF830000000
-1000(FFFFFFFFFFFFFC18): >> 26 = FFFFFFFFFFFFFFFF	<< 26 = FFFFFFF060000000
-1000(FFFFFFFFFFFFFC18): >> 27 = FFFFFFFFFFFFFFFF	<< 27 = FFFFFFE0C0000000
-1000(FFFFFFFFFFFFFC18): >> 28 = FFFFFFFFFFFFFFFF	<< 28 = FFFFFFC180000000
-1000(FFFFFFFFFFFFFC18): >> 29 = FFFFFFFFFFFFFFFF	<< 29 = FFFFFF8300000000
-1000(FFFFFFFFFFFFFC18): >> 30 = FFFFFFFFFFFFFFFF	<< 30 = FFFFFF0600000000
-1000(FFFFFFFFFFFFFC18): >> 31 = FFFFFFFFFFFFFFFF	<< 31 = FFFFFE0C00000000
-1000(FFFFFFFFFFFFFC18): >> 32 = FFFFFFFFFFFFFFFF	<< 32 = FFFFFC1800000000
-1000(FFFFFFFFFFFFFC18): >> 33 = FFFFFFFFFFFFFFFF	<< 33 = FFFFF83000000000
-1000(FFFFFFFFFFFFFC18): >> 34 = FFFFFFFFFFFFFFFF	<< 34 = FFFFF06000000000
-1000(FFFFFFFFFFFFFC18): >> 35 = FFFFFFFFFFFFFFFF	<< 35 = FFFFE0C000000000
-1000(FFFFFFFFFFFFFC18): >> 36 = FFFFFFFFFFFFFFFF	<< 36 = FFFFC18000000000
-1000(FFFFFFFFFFFFFC18): >> 37 = FFFFFFFFFFFFFFFF	<< 37 = FFFF830000000000
-1000(FFFFFFFFFFFFFC18): >> 38 = FFFFFFFFFFFFFFFF	<< 38 = FFFF060000000000
-1000(FFFFFFFFFFFFFC18): >> 39 = FFFFFFFFFFFFFFFF	<< 39 = FFFE0C0000000000
-1000(FFFFFFFFFFFFFC18): >> 40 = FFFFFFFFFFFFFFFF	<< 40 = FFFC180000000000
-1000(FFFFFFFFFFFFFC18): >> 41 = FFFFFFFFFFFFFFFF	<< 41 = FFF8300000000000
-1000(FFFFFFFFFFFFFC18): >> 42 = FFFFFFFFFFFFFFFF	<< 42 = FFF0600000000000
-1000(FFFFFFFFFFFFFC18): >> 43 = FFFFFFFFFFFFFFFF	<< 43 = FFE0C00000000000
-1000(FFFFFFFFFFFFFC18): >> 44 = FFFFFFFFFFFFFFFF	<< 44 = FFC1800000000000
-1000(FFFFFFFFFFFFFC18): >> 45 = FFFFFFFFFFFFFFFF	<< 45 = FF83000000000000
-1000(FFFFFFFFFFFFFC18): >> 46 = FFFFFFFFFFFFFFFF	<< 46 = FF06000000000000
-1000(FFFFFFFFFFFFFC18): >> 47 = FFFFFFFFFFFFFFFF	<< 47 = FE0C000000000000
-1000(FFFFFFFFFFFFFC18): >> 48 = FFFFFFFFFFFFFFFF	<< 48 = FC18000000000000
-1000(FFFFFFFFFFFFFC18): >> 49 = FFFFFFFFFFFFFFFF	<< 49 = F830000000000000
-1000(FFFFFFFFFFFFFC18): >> 50 = FFFFFFFFFFFFFFFF	<< 50 = F060000000000000
-1000(FFFFFFFFFFFFFC18): >> 51 = FFFFFFFFFFFFFFFF	<< 51 = E0C0000000000000
-1000(FFFFFFFFFFFFFC18): >> 52 = FFFFFFFFFFFFFFFF	<< 52 = C180000000000000
-1000(FFFFFFFFFFFFFC18): >> 53 = FFFFFFFFFFFFFFFF	<< 53 = 8300000000000000
-1000(FFFFFFFFFFFFFC18): >> 54 = FFFFFFFFFFFFFFFF	<< 54 = 600000000000000
-1000(FFFFFFFFFFFFFC18): >> 55 = FFFFFFFFFFFFFFFF	<< 55 = C00000000000000
-1000(FFFFFFFFFFFFFC18): >> 56 = FFFFFFFFFFFFFFFF	<< 56 = 1800000000000000
-1000(FFFFFFFFFFFFFC18): >> 57 = FFFFFFFFFFFFFFFF	<< 57 = 3000000000000000
-1000(FFFFFFFFFFFFFC18): >> 58 = FFFFFFFFFFFFFFFF	<< 58 = 6000000000000000
-1000(FFFFFFFFFFFFFC18): >> 59 = FFFFFFFFFFFFFFFF	<< 59 = C000000000000000
-1000(FFFFFFFFFFFFFC18): >> 60 = FFFFFFFFFFFFFFFF	<< 60 = 8000000000000000
-1000(FFFFFFFFFFFFFC18): >> 61 = FFFFFFFFFFFFFFFF	<< 61 = 00000000
-1000(FFFFFFFFFFFFFC18): >> 62 = FFFFFFFFFFFFFFFF	<< 62 = 00000000
-1000(FFFFFFFFFFFFFC18): >> 63 = FFFFFFFFFFFFFFFF	<< 63 = 00000000
-1000(FFFFFFFFFFFFFC18): >> 64 = FFFFFFFFFFFFFFFF	<< 64 = 00000000
-1000(FFFFFFFFFFFFFC18): >> 65 = FFFFFFFFFFFFFFFF	<< 65 = 00000000
10(0000000A): >>  3 = 00000001	<<  5 = 00000140
-100(FFFFFFFFFFFFFF9C): >>  3 = FFFFFFFFFFFFFFF3	<<  5 = FFFFFFFFFFFFF380
0(00000000): >>  3 = 00000000	<<  5 = 00000000
1(00000001): >>  3 = 00000000	<<  5 = 00000020
0(00000000): >>  3 = 00000000	<<  5 = 00000000
1(00000001): >>  3 = 00000000	<<  5 = 00000020
0(00000000): >>  3 = 00000000	<<  5 = 00000000
0(00000000): >>  3 = 00000000	<<  5 = 00000000
123(0000007B): >>  3 = 0000000F	<<  5 = 00000F60

Warning: A non-numeric value encountered in %s on line %d

Warning: A non-numeric value encountered in %s on line %d
0(00000000): >>  3 = 00000000	<<  5 = 00000000

Warning: A non-numeric value encountered in %s on line %d

Warning: A non-numeric value encountered in %s on line %d
0(00000000): >>  3 = 00000000	<<  5 = 00000000
